/**
 * 
 */
package utility.math;

import java.io.Serializable;

/**
 * @author tioz
 *
 */
public class Rotation implements Transformation, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 645865709064401476L;

	/**
	 * 
	 */
	
	double[][] m;
	
	
	
	
	public Rotation(double theta) {
		m[0][0]=  Math.cos(theta); m[0][1]= -Math.sin(theta);
		m[1][0]=  Math.sin(theta); m[1][1]=  Math.cos(theta);
	}

	/* (non-Javadoc)
	 * @see utility.math.Transformation#ApplyTo(utility.math.Vector2D)
	 */
	@Override
	public Vector2D applyTo(Vector2D v) {
		return new Vector2D(m[0][0]*v.getX() + m[0][1]*v.getY(),
							m[0][1]*v.getX() + m[1][1]*v.getY());
	}
	public void transform(Vector2D v)
	{
		v = applyTo(v);
	}
}
